<?php
namespace core\lib\drive\log;
use core\lib\Config;
class File{
	//日志存储位置
	public $path;
	public function __construct(){
		$conf = Config::get('OPTION','log');
		$this->path = $conf['PATH'];
	}
	public function log($message,$file = 'log'){
		$datedir = $this->path.date('YmdH');
		if(!is_dir($datedir)){
			mkdir($datedir,'0777',true);
		}
		$time = date('Y-m-d H:i:s').'  ';
		return file_put_contents($datedir.'/'.$file.'.php',$time.json_encode($message).PHP_EOL,FILE_APPEND);
	}
}